home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Frameworks / Extension Shell 1.3 / Sample Extensions / Bell Test ƒ / BTAddrsTable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-06  |  2.7 KB  |  97 lines  |  [TEXT/R*ch]

  1. /*    NAME:
  2.         BTAddrsTable.c
  3.  
  4.     WRITTEN BY:
  5.         Dair Grant
  6.  
  7.     DESCRIPTION:
  8.         This file contains a a code resource that acts as a Gestalt Selector
  9.         function to be installed as an address table. When called, it will
  10.         return the address of its internal address table. This is the most
  11.         flexible mechanism for code installed from an Extension to find out
  12.         the address of the thing it replaced.
  13.  
  14.     NOTES:
  15.         •    Compiled with THINK C 6.0.
  16.         
  17.         •    The table returned by this address table is NOT the standard ES
  18.             address table. This table is much smaller, and contains a handle.
  19.             See AddrsTable.h for the exact structure.
  20.  
  21.     ___________________________________________________________________________
  22.  
  23.     VERSION HISTORY:
  24.         (Jan 1994, dg)
  25.             •    First publicly distributed version.
  26.  
  27.         (Mar 1994, dg)
  28.             •    Extended address table, uses code block to play sound.
  29.  
  30.             
  31.     ___________________________________________________________________________
  32. */
  33. //=============================================================================
  34. //        Include files                                                                     
  35. //-----------------------------------------------------------------------------
  36. #include "StandaloneCode.h"
  37. #include "BTAddrsTable.h"
  38.  
  39.  
  40.  
  41.  
  42.  
  43. //=============================================================================
  44. //        Function prototypes                                                                     
  45. //-----------------------------------------------------------------------------
  46. pascal OSErr main(OSType theSelector, long *theResponse);
  47.  
  48.  
  49.  
  50.  
  51.  
  52. //=============================================================================
  53. //        Global variables                                                                 
  54. //-----------------------------------------------------------------------------
  55. BTAddressTable    gTheAddressTable;            // NB - NOT declared as AddressTable
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. //=============================================================================
  67. //        main : Entry point to our Gestalt Selector function.                                                                 
  68. //-----------------------------------------------------------------------------
  69. //        Note :    This code is used to store a table of ProcPtrs. This is set up
  70. //                by Extension Shell so that code installed into the System Heap
  71. //                can find out the address of the thing that replaced them.
  72. //
  73. //                We do not initialise theAddressTable. We assume that the first
  74. //                person to call us is ExtensionShell, and it initialises it.
  75. //-----------------------------------------------------------------------------
  76. pascal OSErr main(OSType theSelector, long *theResponse)
  77. {
  78.  
  79.  
  80.  
  81.  
  82.     // Set up A4 to get access to our globals
  83.     GetGlobals();
  84.  
  85.     
  86.             
  87.     // Return the address of theAddressTable. We treat theResponse as a pointer
  88.     // to a variable that's a pointer to an address table, and write to it
  89.     // accordingly.
  90.     *theResponse = (long) &gTheAddressTable;
  91.  
  92.  
  93.  
  94.     // Restore A4 for our caller.
  95.     UngetGlobals();
  96. }
  97.